<template>
  <div class="box">
    <div class="box-item" v-for="(item,index) in options" :key="item.name">
      <div class="icon">
        <img :src="item.icon" alt="">
      </div>
      <div class="info">
        <div class="value">
          {{ data[item.value] || 0 }}<span>{{ item.unit }}</span>
        </div>
        <div class="name">{{ item.name }}</div>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  name: "Center",
  props: {
    data: {
      type: Object,
      default: () => ({}),
    },
  },
  data(){
    return {
      options: [
        {
          name: '今日工作车辆',
          value: 'workingCars',
          icon: require('@/assets/images/bigScreen/top/car.png'),
          unit: '辆',
        },
        {
          name: '今日休息车辆',
          value: 'restingCars',
          icon: require('@/assets/images/bigScreen/top/xx_car.png'),
          unit: '辆',
        },
        {
          name: '今日工作人员',
          value: 'workingEmployees',
          icon: require('@/assets/images/bigScreen/top/person.png'),
          unit: '人',
        },
        {
          name: '今日休息人员',
          value: 'restingEmployees',
          icon: require('@/assets/images/bigScreen/top/xx_person.png'),
          unit: '人',
        },
      ],
    };
  },
}
</script>

<style scoped lang="scss">
.box {
  display: flex;
  align-items: center;

  &-item {
    position: relative;
    height: max-content;
    .icon {
      height: max-content;
      img {
        height: 60px;
        object-fit: cover;
      }
    }
    .info {
      position: absolute;
      top: 44%;
      left: calc(50% + 6px);
      transform: translate(-50%,-50%);
      .value {
        color: #75B9EE;
        font-weight: bold;
        font-size: 20px;
        span {
          color: #fff;
          font-size: 10px;
          vertical-align: bottom;
          font-weight: normal;
        }
      }
      .name {
        color: #fff;
        font-size: 10px;
        margin-top: 2px;
      }
    }
  }
}
</style>
